<?python 
  
  from fasttrack.utils import fmt, textilize, getGroups
  from turbogears import identity
  
  user_person = identity.current.user
  groupids = getGroups()
?>

<span xmlns:py="http://purl.org/kid/ns#">

<span py:def="note_content()">
	<div class="note_content" id="note_content_$note.id">
		<div>${XML(textilize(note.note))}</div>
		<div py:if="note.last_edit_date != None"><i>Last edited: ${fmt(note.last_edit_date)}</i></div>
		<br/>
		<div class="note_info">
			<span>
			Posted by <a class="note_creator" href="mailto:$note.creator.emailAddress">${note.creator.displayName}</a> 
			on ${fmt(note.creation_date)}
			</span>
			<a py:if="(user_person == note.creator or 'admin' in groupids) and not read_only" style="display: none" id="edit_note_link_$note.id" href="#" class="edit_note_link" onclick="request_note_content($note.id); return false;">edit</a>
			<a py:if="(user_person == note.creator or 'admin' in groupids) and not read_only" style="display: none" id="remove_note_link_$note.id" href="#" class="remove_note_link" onclick="remove_note($note.id); return false;">remove</a>
		</div>
	</div>
	<div py:if="not read_only" class="note_content" id="edit_note_$note.id" style="display: none;">
		<textarea style="display: block; width: 540px; height: 275px;" id="ta_edit_note_$note.id" name="content" rows="16" cols="74"></textarea><br/>
		<a href="#" onclick="edit_note($note.id); return false;">save</a>
		<a href="#" onclick="cancel_edit($note.id); return false;">cancel</a>
		<br/>
	</div>
</span>

<li py:if="include_container" id="note_$note.id" class="note" onmouseover="show_inline('remove_note_link_$note.id');show_inline('edit_note_link_$note.id')" onmouseout="hide('remove_note_link_$note.id'); hide('edit_note_link_$note.id');">
  ${note_content()}
</li>

<span py:if="not include_container" py:replace="note_content()" />

</span>